//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "dumpthread.h"
#include "vdskapi.h"
#include "functions.h"
#include <stdio.h>
#include "main.h"

#pragma package(smart_init)
extern TForm1 *Form1;
//---------------------------------------------------------------------------

//   Important: Methods and properties of objects in VCL can only be
//   used in a method called using Synchronize, for example:
//
//      Synchronize(&UpdateCaption);
//
//   where UpdateCaption could look like:
//
//      void __fastcall dumpthread::UpdateCaption()
//      {
//        Form1->Caption = "Updated in a thread";
//      }
//---------------------------------------------------------------------------

__fastcall dumpthread::dumpthread(bool CreateSuspended)
    : TThread(CreateSuspended)
{
}
//---------------------------------------------------------------------------
extern double disksize;
void __fastcall dumpthread::Execute()
{
    NameThreadForDebugging("dumpthread");
    //---- Place thread code here ----
    Form1->current->Text="DUMPING";
     char *b = new char[disksize];
    nread((unsigned long)b, 0, 10*1024*1024, 0);
    dump(b, 10*1024*1024, "fulldump");



    int crc=checksum((unsigned short*)b, disksize);
    char temp[129];
    sprintf(temp,"done dump, crc=0x%04X", crc);
    deb(temp);
    Form1->current->Text=temp;
    delete[]b;
    Form1->Button4->Enabled=true;
}
//---------------------------------------------------------------------------
